As this is the very first exercise in this workshop, it is relatively easy and short. Its purpose is to get used to this exercise format and, more importantly, to install all necessary packages for this course.

Note: You can find the solutions for this exercise and all other exercises in the ./solutions folder in the repo/directory that contains the course materials. You can copy code from these exercise files by clicking on the small blue clipboard icon in the code boxes’ upper right corner.

And here comes our very first exercise:

1

Please install all packages that are listed on slide XX of the Introduction slides (“XXX.html”).
We always recommend using the easypackages packages, which can be installed with the command install.packages("easypackages"). After loading the package with library(easypackages) you can load and install packages with the command easypackages::packages("fancy_package_1", "fancy_package_2", ...).
easypackages::packages(
  "tidyverse"
)
## All packages loaded successfully

And here’s another quick exercise

2

Load R’s built-in dataset USAarrests, convert it to a tibble and feed it into the function dplyr::glimpse(). Ideally, you use a %>%-workflow for the last two steps. What do you think happens to the output?
We can import built-in data using the data() function and set the data name into quotation marks.
data("USArrests")

USArrests %>% 
  tibble::as_tibble() %>% 
  dplyr::glimpse()
## Rows: 50
## Columns: 4
## $ Murder   <dbl> 13.2, 10.0, 8.1, 8.8, 9.0, 7.9, 3.3, 5.9, 15.4, 17.4, 5.3, 2.6, 10.4, 7.2, 2.2, 6.0, 9.7, 15.4, 2.1, 11.3, 4.4, 12.1, 2.7, 16.1~
## $ Assault  <int> 236, 263, 294, 190, 276, 204, 110, 238, 335, 211, 46, 120, 249, 113, 56, 115, 109, 249, 83, 300, 149, 255, 72, 259, 178, 109, 1~
## $ UrbanPop <int> 58, 48, 80, 50, 91, 78, 77, 72, 80, 60, 83, 54, 83, 65, 57, 66, 52, 66, 51, 67, 85, 74, 66, 44, 70, 53, 62, 81, 56, 89, 70, 86,~
## $ Rape     <dbl> 21.2, 44.5, 31.0, 19.5, 40.6, 38.7, 11.1, 15.8, 31.9, 25.8, 20.2, 14.2, 24.0, 21.0, 11.3, 18.0, 16.3, 22.2, 7.8, 27.8, 16.3, 35~
# dplyr::glimpse() provides another method of displaying the data. In such small 
# datasets, in doesn't make a hughe difference. But as tibbles' output are 
# reduced for large datasets, it provides a convenient method of getting a quick 
# glimpse (haha) on the data.